package com.xiaoyong.ojbackend.judge.codesandbox.impl;

import com.xiaoyong.ojbackend.judge.codesandbox.CodeSandbox;
import com.xiaoyong.ojbackend.judge.codesandbox.model.ExecuteCodeRequest;
import com.xiaoyong.ojbackend.judge.codesandbox.model.ExecuteCodeResponse;
import com.xiaoyong.ojbackend.judge.codesandbox.model.JudgeInfo;
import com.xiaoyong.ojbackend.model.enums.JudgeInfoMessageEnum;

import java.util.List;

/**
 * 示例代码沙箱（仅为了跑通业务流程）
 */
public class ExampleCodeSandbox implements CodeSandbox {
    @Override
    public ExecuteCodeResponse executeCode(ExecuteCodeRequest executeCodeRequest) {
        System.out.println("示例代码沙箱");

        List<String> inputList = executeCodeRequest.getInputList();
        JudgeInfo judgeInfo = new JudgeInfo();
        judgeInfo.setMemory(100L);
        judgeInfo.setTime(100L);
        judgeInfo.setMessage(JudgeInfoMessageEnum.ACCEPTED.getText());
        return ExecuteCodeResponse.builder()
                .message("测试执行成功")
                .outputList(inputList)
                .judgeInfo(judgeInfo)
                .build();
    }
}
